//index.js
var util = require('../../utils/util.js');
var api = require('../../config/api.js');
//获取应用实例
Page({
  data: {
    orderId: 0,
    logisticsTraces: {},
    expName:'顺丰速递',
    number:'未知',
    loadingHidden:true
  },
  onLoad: function (e) {
    var orderId = e.id;
    this.data.orderId = orderId;
  },
  onShow: function () {
    this.getList();


  },
  getList: function () {
    var that = this;
    util.request(api.FegineInfo, {
      orderId: that.data.orderId
    },'post').then(function (res) {
      wx.hideLoading();
      if (res.data.status != 0) {
        wx.showModal({
          title: '错误',
          content: '快递查询失败，请稍后重试',
          showCancel: false
        })
        that.setData({
          number: '未知',
          expName: '未知',
          loadingHidden:false
        });
        return false;
      }
      that.setData({
        logisticsTraces: res.data.fegineList,
        number:res.data.number,
        expName:res.data.expname,
        loadingHidden: false
      });
    });
  }
})
